package com.hy;

/**
 * Created With IntelliJ IDEA.
 * Descriptions:测试引用计数算法
 * author: Mr.Du
 * Date: 2022/12/5
 * Time: 11:35
 */
public class TestObjectDead {
    
    public Object instance = null;
    
    private static final int _1MB = 1024 * 1024;
    
    private byte[] bigSize = new byte[2 * _1MB];
    
    public static void testGc(){
        TestObjectDead objA = new TestObjectDead();
        TestObjectDead objB = new TestObjectDead();
        objA.instance = objB;
        objB.instance = objA;
        objA = null;
        objB = null;
        
        System.gc();
    }
    
    public static void main(String[] args) {
        testGc();
    }
}
